<template>
  <div>
	<div id="position">
		<div id="manual">
		  <label class="title">手动选择</label>
		  <div id="manual_style">
		  	<ul>
		  		<li v-for="school in schoolList" >
		  			<label @click="choose(school.shopCode,school.shopName)">{{school.shopName}}</label>
		  		</li>
		  	</ul>
		  </div>	
		</div>
	</div>
  </div>
</template>
<script type="text/javascript">
import axios from 'axios'
 import router from '../router/router'
export default {
       data: function() {
            return {
               
                isPoistion: true,
                positionMsg:"定位中,请稍后...",
                schoolList:[
                ] 
            }
        },
	   created() {

            // head的修改
            this.$store.commit('changeIndexConf', {
                isFooter: false,
            })
           
          
            
        }, 
       
        mounted: function(){
        
           this.positionAction();
        
         
             
        },
        methods:{
          reloadAction:function(){
        
            
          },
        	positionAction:function(){
            this.isPoistion=true;    
            this.positionMsg="定位中,请稍后...";
           	var _self=this;
            axios.get('/shop/relateShop.do?longitude=0&latitudes=0')
             .then(function (response) {
             var schoolArr=new Array();
             schoolArr=response.data;
             _self.schoolList=schoolArr;
             _self.isPoistion=false;
             _self.positionMsg=schoolArr[0].shopName;
             store.set("position",schoolArr[0].shopCode);
             store.set("shopName", schoolArr[0].shopName);
             if (store.get('userInfo')=="") {
                if (schoolArr[0].shopType==1) {
                  router.push("/unmannedLogin");
                }else{
                  
                  
                }
               
              }else{
                 if (store.get('isReload')=="") {
                  //router.push("/first");
                 }   
              }
            
            })
           .catch(function (error) {
            store.set("position","XM0001");
            store.set("shopName", "暂无法购买");
            router.push("/first");
            });
         
        	},
            choose:function(code,name){
              this.positionMsg=name;
               store.set("position",code);
               store.set("shopName", name);
               router.push('/first')
            }
        }
}
</script>
<style lang="scss" scoped>
	@import "../../static/css/position.scss";
</style>